<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Config extends AdminController {

	function __construct() { 
		parent::__construct();
		$this -> load -> model("Dic_model");	
		$this -> sidebar = "Member-User";
	}

	public function set_config() {
		
		$data =$this->Dic_model->get_single(array('dic_key'=>'is_config'));
		$data['title'] = $data['dic_value'];
		$data['caption'] = $data['caption'];
		$data['is_close'] = $data['z_index'];//是否关闭 0 :未关闭,1表示已关闭

		$this -> load -> view('admin/config',$data);
	}


	//配置系统状态
	public function save($is_close) {

		if($is_close == CommonWhether::Not[XPHEnum::Value]){ //关闭系统
			$parm['dic_key'] = 'is_config';
			$parm['dic_value'] = '打开系统';
			$parm['caption'] = '系统已关闭';
			$parm['z_index'] = '1';
			$this->Dic_model->update($parm,'dic_key');

			exit(retJson("关闭成功.", true));

		}else{ //打开系统

			$parm['dic_key'] = 'is_config';
			$parm['dic_value'] = '关闭系统';
			$parm['caption'] = '系统已打开';
			$parm['z_index'] = '0';
			$this->Dic_model->update($parm,'dic_key');

			exit(retJson("打开成功.", true));

		}		
	}			
}